package com.central.rearService.controller

import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.central.common.annotation.LoginUser
import com.central.common.model.CommonResult
import com.central.common.model.PageVo
import com.central.common.model.SysUser
import com.central.post.pojo.report.GetReportListDto
import com.central.post.pojo.report.GetReportListVo
import com.central.post.pojo.report.ReportInsertDto
import com.central.rearService.service.ReportService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import springfox.documentation.annotations.ApiIgnore

/**
 * @author  fly
 * @date  2021/5/26 14:55
 * @version 1.0
 */
@Api(tags = ["(小程序) 举报模块"])
@RestController
@RequestMapping("report")
open class ReportController {

    @Autowired
    private lateinit var reportService: ReportService


    @ApiOperation("添加举报")
    @PostMapping("/addReport")
    fun addReport(reportInsertDto: ReportInsertDto, @ApiIgnore @LoginUser sysUser: SysUser): CommonResult<Boolean> =
        reportService.addReport(reportInsertDto, sysUser)

    @ApiOperation("移除举报")
    @PostMapping("/remove")
    fun remove(ids: String): CommonResult<Boolean> =
        reportService.remove(ids)

    @ApiOperation("获取举报列表")
    @PostMapping("/getReportList")
    fun getReportList(pageVo: PageVo, getReportListDto: GetReportListDto, @ApiIgnore @LoginUser sysUser: SysUser): CommonResult<Page<GetReportListVo>> =
        reportService.getReportList(pageVo, getReportListDto, sysUser)

}